Top 10k strings from M-Code Library 2 - Window Scrolling (1985)(16-48 Tape Magazine).z80 in <root> / bin / z80 / software / Sinclair Spectrum Collection TOSEC.exe / Sinclair ZX Spectrum - Utilities & Educational / Sinclair ZX Spectrum - Utilities & Educational - [Z80] (TOSEC-v2007-01-01) /

Back to the directory listing

   3 ;"lib2code"
   2 WINDOW SCROLLING ROUTINE
   2 PRESS A KEY
   2 ;"wincode"
   2 ;"library 2"
   2 "lib2code"
   2  copies.)"
   1 z$="10020203
   1 z$="04030104
   1 z$="01020104
   1 o,o;"   Press 
   1 o,o;"    PRESS ANY KEY TO PAUSE
   1 l=l+(l<max)*(k$="6"
   1 ii,o;"The routine at 22AAH in the ROM is called with the y co-ordinatein the B register and the value for x in the C register."
   1 WINDOW SCROLLING
   1 WINDOW SCROLL
   1 STOP THE TAPE
   1 SAVE""wincode""CODE 32000,33
   1 RUN THE TAPE
   1 MEM","","   
   1 M/CODE LIBRARY 2
   1 LET THE TAPE RUN
   1 GENERAL NOTES
   1 DEMONSTRATION
   1 ASSEMBLY LISTING
   1 ;"w=17 characters";
   1 ;"library 2":
   1 ;"Verified O.K. Press any key.   ":
   1 ;"Use up and down keys to read thenotes. 
   1 ;"Saved and verified O.K.
   1 ;"Rewind and play to verify.":
   1 '"The subroutine returns with the address of the screen byte in   the HL register pair. (It also  puts the pixel position within  that byte into the A register,  but we will ignore that in this program.)"
   1 '"The scroll uses CALL 22AAH to   get the address of the start of each row of pixels into DE and  the address of the row beneath  into HL. Then it moves the lowerrow up with LDIR."
   1 '"The routine calls a very useful routine in the ROM. This residesat 22AAH (8873 decimal) and is  used to find the screen address of any pixel."
   1 '"Since this is the only CALL, thecode is relocatable.";#i;
   1 "library 2"
   1 "So just to recap-","","POKE MEM+1,y","POKE MEM+3,x","POKE MEM+10,h","POKE MEM+23,w","RANDOMIZE 
   1 "3",o;"This month we give a short
   1 "23658",o:
   1 ","LOOP again if we have not done  all the rows.","   RET","Back to BASIC."
   1 ","","","This demo shows","one way of","using the window.","","If we load the","code at MEM","(in this case","MEM=32000)","We must...","","POKE MEM+1,y","","POKE MEM+3,x","","POKE MEM+10,h","","POKE MEM+23,w","","and call the","routine with","","RANDOMISE USR MEM"
   1 "(300+100*
   1 "","The words seem","to come from","nowhere because","they are printed","in blue ink on","blue paper.","","Since the routine","only scrolls the","ink, you don't","see it until it","scrolls into the","line above.","",""
   1 "   POP DE","Get the upper row address off   the stack into DE.","   PUSH HL","Save the lower row address on   the stack. It will be the upper row address next time.","   LD   B,0","Empty the B register as LDIR    will only need 32 bytes max.","   LD   C,WIDE","Load BC with the width of the   window in bytes."
   1 "   POP BC","Retreive x,y co-ordinates.","   LD   A,HIGH","Load the A register with the    height of the window(in pixels).This acts as a counter.","
   1 "   LDIR","Move the row of pixels up.","   POP  HL","Retreive the lower row address.","   POP  BC","Retreive the x,y co-ordinates.","   POP  AF","Retreive the row count.","   DEC  A","One row less left to do."
   1 "   LD   B,Y","Put upper Y co-ordinate in B.","   LD   C,X","Put left X co-ordinate in C.","   PUSH BC","Save BC because B is corrupted  by the ROM routine.","   CALL 22AAH","Call the pixel address routine. HL now holds address of top row."
   1 "   JR   NZ,
   1 "   DEC  B","Drop Y by one to find the
   1  to read again or,
   1  routine (only 33 bytes) which   will scroll the contents of any size of window. As written it   scrolls upward, but when you seehow it is done you shouldn't    have any trouble making it work downwards."
   1  for the menu."
   1  for the menu, 
   1  address of the next row down.","   PUSH BC","Save the x and y values.","   PUSH HL","Save the upper row address on   the stack.","   CALL 22AAH","Call the ROM to put the lower   row address in HL."
   1  WINDOW SCROLL 
   1  Press any key.":
   1  PUSH AF","Save the counter"
   1   for tape,";
   1   for microdrive,";
   1   for menu."
   1   HOW IT WORKS